/*
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.Credentials;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;

import retrofit.client.Client;
import retrofit.client.Request;
import retrofit.client.Response;



有更优解决 ，暂时不用这个Utils了





public class MyClient implements Client {
    private final CloseableHttpClient delegate;

    public MyClient(String user, String pass, String hostname, String scope) {
        Credentials credentials = new UsernamePasswordCredentials(user, pass);
        AuthScope authScope = new AuthScope(hostname, 443, scope);

        CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
        credentialsProvider.setCredentials(authScope, credentials);

        delegate = HttpClientBuilder.create()
                .setDefaultCredentialsProvider(credentialsProvider)
                .build();
    }

    @Override public Response execute(Request request) {
        //
        // We're getting a Retrofit request, but we need to execute an Apache
        // HttpUriRequest instead. Use the info in the Retrofit request to create
        // an Apache HttpUriRequest.
        //
        String method = req.getMethod();

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        if (request.getBody() != null) {
            request.getBody().writeTo(bos);
        }
        String body = new String(bos.toByteArray());

        HttpUriRequest wrappedRequest;
        switch (method) {
            case "GET":
                wrappedRequest = new HttpGet(request.getUrl());
                break;
            case "POST":
                wrappedRequest = new HttpPost(request.getUrl());
                wrappedRequest.addHeader("Content-Type", "application/xml");
                ((HttpPost) wrappedRequest).setEntity(new StringEntity(body));
                break;
            case "PUT":
                wrappedRequest = new HttpPut(request.getUrl());
                wrappedRequest.addHeader("Content-Type", "application/xml");
                ((HttpPut) wrappedRequest).setEntity(new StringEntity(body));
                break;
            case "DELETE":
                wrappedRequest = new HttpDelete(request.getUrl());
                break;
            default:
                throw new AssertionError("HTTP operation not supported.");
        }

        //
        // Then execute the request with `delegate.execute(uriRequest)`.
        //
        // ...
        //
    }*/
